package com.example.androidpractice.lifecycle;


import android.content.Context;
import android.util.Log;
import android.widget.Toast;

import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;

public class MyActivityObserver implements LifecycleObserver {
    private static final String TAG="MyActivityObserver";
    private Context context;
    private Lifecycle lifecycle;
    public MyActivityObserver(Context context, Lifecycle lifecycle) {
         this.context=context;
         this.lifecycle=lifecycle;
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
    public void onActivityResume(){
        if (lifecycle.getCurrentState().isAtLeast(Lifecycle.State.CREATED)){
            Log.d(TAG,"last status");
        }
        Log.d(TAG,"onActivityResume");
    }



    @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
    public void onActivityPause(){

        Log.d(TAG,"onActivityPause");

    }
}
